package job

import "aglaia/global"

var (
	emailChan chan Email
)

type Email struct {
	Type    string `json:"type"`
	Content map[string]string
}

func EmailJob() {
	if emailChan != nil {
		global.Logger.Infof("email channel is not nil")
		return
	}

	emailChan = make(chan Email)
	go func(emailChan chan Email) {
		for {
			email := <-emailChan
			global.Logger.Errorf("EmailJob: %#v\n", email)
		}
	}(emailChan)
}
